package cn.kuick.match2.test4;

public class SearchInsertPosition {

	public static int handle(int[] nums, int target) {
		for(int i=0; i<nums.length - 1; i++) {
			if (nums[i] < target && target < nums[i + 1]) {
				return i+1;
			} else if (target <= nums[i]) {
				return i;
			}
		}
		
		return nums.length;
	}
	
	public static void main(String[] args) {
		int[] input = {1, 3, 5, 7, 9};
		int target = 10;
		
		int output = handle(input, target);
		System.out.println(output);
	}

}
